<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
<%@ taglib uri="http://www.opensymphony.com/sitemesh/page" prefix="page" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="secure,medical,chat">
	<script type="text/javascript" src="../../js/jquery.js"></script>
	<script type="text/javascript">
		function getDoctor(hospital) {
			var hospitalUuid = hospital.value;
			var url = "../fetchDoctor.shtml";
			$.getJSON(url,{hospitalUuid:hospitalUuid},function(json) {
				var doctorList = json.doctorList ;
				var doctores = "";
				$.each(doctorList,function(i,v) {
					doctores += "<option value=" + v.uuid + ">" + v.username + "</option>";
				});
				$("#userUuid").attr("disabled","");
				$("#userUuid").html(doctores);
			});
		}
	</script>
	
  </head>
  
  <body>
  	<div>
  		<s:action id="d1" name="documentAction"></s:action>
  		<s:form action="../assignDocument.shtml" cssStyle="margin: 10 auto; color:#ffffff;">
  			<s:textfield label="FileName" name="document.fileName" readonly="true" value="%{#parameters.fileName}"></s:textfield>
  			<s:hidden name="receivedTime" value="%{#parameters.lastModified}"></s:hidden>
  			<s:select label="Hospital" name="document.hospitalUuid" list="#d1.listHospital()" listKey="uuid" listValue="name" 
  				tooltip="Choose the Hospital" headerKey="-1" headerValue="--Choose the Hospital--" onchange="getDoctor(this)"></s:select>
  			<s:select list="#{'-1':'--Choose the Doctor--'}" id="userUuid" disabled="true" name="document.userUuid" tooltip="Choose the Doctor" label="Doctor"></s:select>
  			<s:textfield label="Medical Record" name="document.medicalRecord" tooltip="Enter the Medical Record"></s:textfield>
  			<s:textfield label="Patient" name="document.patient" tooltip="Enter the Patient"></s:textfield>
  			<s:textarea label="Introduction" name="document.introduction" cols="50" rows="10" tooltip="Enter the Introduction"></s:textarea>
  			<s:submit/>
  		</s:form>
  	</div>
  </body>
</html>
